set -ex

rm -rf ./build
mkdir build
cd build

export CUDA_VISIBLE_DEVICES=2
ARCH=75
# export CUDA_VISIBLE_DEVICES=1
# ARCH=86
# export CUDA_VISIBLE_DEVICES=0
# ARCH=89
# export CUDA_VISIBLE_DEVICES=0
# ARCH=61
# export CUDA_VISIBLE_DEVICES=7
# ARCH=75

nvcc -arch=sm_${ARCH} ../test.cu -o test

# cmd="ncu --set full --target-processes all ./test"
# cmd="nsys profile --gpu-metrics-device=0 ./test"
# cmd="compute-sanitizer --tool memcheck ./test"
cmd="./test"
$cmd

cd ../
rm -rf ./build